<template>
  <section class="hero">
    <div class="particles-container" id="particlesContainer">
      <div class="particle" style="--delay: 0s; --duration: 12s; --size: 8px; --x: 10%; --y: 20%;"></div>
      <div class="particle" style="--delay: 1s; --duration: 16s; --size: 12px; --x: 85%; --y: 15%;"></div>
      <div class="particle" style="--delay: 2s; --duration: 14s; --size: 6px; --x: 20%; --y: 80%;"></div>
      <div class="particle" style="--delay: 3s; --duration: 18s; --size: 10px; --x: 75%; --y: 70%;"></div>
      <div class="particle" style="--delay: 4s; --duration: 13s; --size: 8px; --x: 50%; --y: 30%;"></div>
      <div class="particle" style="--delay: 5s; --duration: 15s; --size: 14px; --x: 15%; --y: 60%;"></div>
      <div class="particle" style="--delay: 6s; --duration: 17s; --size: 6px; --x: 90%; --y: 40%;"></div>
      <div class="particle" style="--delay: 7s; --duration: 19s; --size: 10px; --x: 30%; --y: 90%;"></div>
      <div class="particle" style="--delay: 8s; --duration: 14s; --size: 8px; --x: 80%; --y: 85%;"></div>
      <div class="particle" style="--delay: 9s; --duration: 16s; --size: 12px; --x: 5%; --y: 50%;"></div>
      <div class="particle" style="--delay: 10s; --duration: 12s; --size: 6px; --x: 95%; --y: 25%;"></div>
      <div class="particle" style="--delay: 11s; --duration: 20s; --size: 10px; --x: 40%; --y: 10%;"></div>
      <div class="particle" style="--delay: 12s; --duration: 13s; --size: 8px; --x: 60%; --y: 95%;"></div>
      <div class="particle" style="--delay: 13s; --duration: 15s; --size: 12px; --x: 25%; --y: 35%;"></div>
      <div class="particle" style="--delay: 14s; --duration: 17s; --size: 6px; --x: 70%; --y: 55%;"></div>
    </div>
    <div class="container wrap">
      <div>
        <span class="chip">一站式 AI 视频智能体平台</span>
        <h1 class="headline typewriter">
          <span class="typewriter-line">10 分钟生成爆款视频</span>
          <br>
          <span class="typewriter-line">脚本到成片全程智能驱动</span>
        </h1>
        <p class="sub">海量爆款模板、智能旁白与配乐、字幕翻译一键搞定。为营销团队、内容创作者与品牌增长而生。</p>
        <div class="cta-row">
          <a class="btn primary btn-ripple" href="#market"><svg viewBox="0 0 24 24"><path fill="#fff" d="M3 6h2l3 9h8l3-7H8"/></svg><span>浏览模板市场</span></a>
          <a class="btn btn-ripple" href="#how"><svg viewBox="0 0 24 24"><path fill="currentColor" d="M8 5v14l11-7z"/></svg><span>查看 3 步上手</span></a>
        </div>
      </div>
      <div class="hero-card" id="heroCard">
        <div class="grid-3 hero-stat">
          <div class="stat"><b>1,200+</b><div class="muted">精选模板</div></div>
          <div class="stat"><b>98.6%</b><div class="muted">好评率</div></div>
          <div class="stat"><b>10×</b><div class="muted">提效</div></div>
        </div>
        <div class="muted">拖拽式流程 · 智能体协作 · 云端渲染加速</div>
      </div>
    </div>
  </section>
</template>

<script setup>
import { onMounted, onUnmounted } from "vue";

// 生命周期钩子
onMounted(() => {
  // 创建粒子
  const particlesContainer = document.getElementById("particlesContainer");
  
  // 设置Hero卡片动画
  const heroCard = document.getElementById("heroCard");
  if (heroCard) {
    setTimeout(() => {
      heroCard.classList.add("reveal");
    }, 500);
  }
});

onUnmounted(() => {
  // 清理事件监听器（如果有需要）
});
</script>

<style scoped>
/* Hero区域样式 */
.hero {
  width: 100%;
  display: flex;
  justify-content: center;
  position: relative;
  padding: 140px 0 60px;
  overflow: hidden;
  min-height: 80vh;
  align-items: center;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  position: relative;
  z-index: 1;
}

.wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.particles-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: var(--size);
  height: var(--size);
  background: #0066ff;
  border-radius: 50%;
  opacity: 0.15;
  top: var(--y);
  left: var(--x);
  animation: float var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
  filter: blur(2px);
}

.particle:nth-child(even) {
  background: #4da6ff;
  animation: pulse var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.chip {
  display: inline-block;
  margin-bottom: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,102,255,0.08);
  border: 1px solid rgba(0,102,255,0.2);
  font-weight: 700;
  color: #0066ff;
}

.headline {
  font-size: 48px;
  line-height: 1.2;
  margin: 6px 0 24px;
  max-width: 800px;
}

.typewriter-line {
  display: inline-block;
}

.sub {
  font-size: 18px;
  line-height: 1.6;
  color: #64748b;
  margin-bottom: 32px;
  max-width: 700px;
}

.cta-row {
  display: flex;
  gap: 16px;
  margin-bottom: 48px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  border: 1px solid #dbe6ff;
  color: #1e293b;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn.primary {
  background: linear-gradient(135deg,#0066ff,#4da6ff,#00b3ff);
  color: #fff;
  border: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,102,255,0.15);
}

.btn-ripple {
  position: relative;
  overflow: hidden;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transform: scale(0);
  animation: ripple 0.6s linear;
  pointer-events: none;
}

@keyframes ripple {
  to {
    transform: scale(2.5);
    opacity: 0;
  }
}

.hero-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #ffffff;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 102, 255, 0.08);
  max-width: 700px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
  position: relative;
  border: 0.5px solid rgba(0, 102, 255, 0.1);
}

.hero-card.reveal {
  opacity: 1;
  transform: translateY(0);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  width: 100%;
}

.hero-stat {
  margin-bottom: 16px;
}

.stat {
  text-align: center;
}

.stat b {
  font-size: 28px;
  font-weight: 700;
  color: #0066ff;
  display: block;
  margin-bottom: 4px;
}

.muted {
  font-size: 14px;
  color: #64748b;
}

/* 响应式设计 */
@media (max-width: 960px) {
  .wrap {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  
  .hero-card {
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .hero {
    padding: 120px 0 40px;
    text-align: center;
  }

  .headline {
    font-size: 36px;
  }

  .sub {
    font-size: 16px;
    margin-left: auto;
    margin-right: auto;
  }

  .cta-row {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .headline {
    font-size: 28px;
  }

  .cta-row {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}
</style>
